<?php
// +------------------------------------------------------------------------------	
//	@desc adminController.php
//  @date Wed Aug 19 CST 2009
//  @author Fly Jin <flysharping@gamil.com>
// +------------------------------------------------------------------------------
class adminmController extends adminAuth{
	private $tab_line_organize_tour;
	
	function __construct(){
		parent::__construct();
		$this->tab_line_organize_post       = T . 'line_organize_post';
	}

	function index(){
		$this->display = 'admin/main.html';
	}

	//Modify Password
	function setPwd(){
		$AdminUser=loadModel('AdminUser');
		if ($AdminUser->isLogin()) {
			if (!empty($_POST['oldpassword'])&&!empty($_POST['newpassword'])&&!empty($_POST['conpassword'])) {
				if ($_POST['newpassword']==$_POST['conpassword']) {
					$mofy=$this->member->setPwd($_POST['oldpassword'],$_POST['newpassword']);
				}
				if ($mofy==1) {
					redirect_url('/admin/main','修改密码成功！');
				}elseif ($mofy==2){
					redirect_url('/adminm/setpwd','输入的oldPassword不正确！');
				}elseif ($mofy==0){
					redirect_url('/adminm/setpwd','修改密码失败！');
				}
			}else{
				$this->display = '/admin/setpwd.htm';
			}
		}else {
			redirect("/admin");
		}
	}
	
	function addCating(){
		$cate=new Cate();
		$insertID=$cate->add($_POST['parentNode'], $_POST['catTitle'], $_POST['description'], $_POST['catImage']);
		if ($insertID>0) {
			redirect_url('/admin/addCat','Add succeed');	
		}
	}

}
?>